-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔍 add searchsorted to get equidistant x-bins #11
Conversation
// TODO | ||
// - m4 & minmax should determine bin size on x-range! | ||
// code now assumes equal bin size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extremely happy to tick this one off 🔥
@@ -157,13 +153,13 @@ macro_rules! create_pyfuncs_without_x_with_ratio { | |||
|
|||
macro_rules! create_pyfuncs_with_x { | |||
($resample_mod:ident, $resample_fn:ident, $mod:ident) => { | |||
_create_pyfuncs_with_x_generic!(_create_pyfunc_with_x, $resample_mod, $resample_fn, $mod, f16 f32 f64 i16 i32 i64 u16 u32 u64, f16 f32 f64 i8 i16 i32 i64 u8 u16 u32 u64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed f16
support as this (i) does not make sense IMO as x-data type (for this library which focuses on resampling very large time series) and (ii) is probably (haven't tested this) a lot slower than the other datatypes bc equidistant binning not (yet) adapted to f16
(which is not supported by most CPUs)
}; | ||
} | ||
|
||
macro_rules! create_pyfuncs_with_x_with_ratio { | ||
($resample_mod:ident, $resample_fn:ident, $mod:ident) => { | ||
_create_pyfuncs_with_x_generic!(_create_pyfunc_with_x_with_ratio, $resample_mod, $resample_fn, $mod, f16 f32 f64 i16 i32 i64 u16 u32 u64, f16 f32 f64 i8 i16 i32 i64 u8 u16 u32 u64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See ⬆️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skimmed my own code 🤡, LGTM
This PR alleviates the assumption that when
x
has fixed sampling rate (& no gaps) for certain downsample algorithms.Should fix #10.
This PR has the following contributions:
utils.rs
val_step
as this avoids rounding errors with integer / usize x-data types!! => seems to be significantly slower for minmaxlttb (10 - 20 %)
x
x
x
?n_out
requirements etc.)generic
code of the downsample algorithmsAlgorithm changes:
=> when
arr.len
%n_out
= 0 & equally sampled (+ no gaps) => difference betweeen with x and without x implementation=> when
arr.len
%n_out
= 0 & equally sampled (+ no gaps) => difference betweeen with x and without x implementationPython binding changes:
f16
as supportedx
datatype (IMO, no 16-bit dtypes make sense asx
datatype... as these at max (u16) can only represent up to 65_535 values)n_out
to be multiple of 4n_out
to be multiple of 2